// JavaScript Document

// 首页公告

var swiper = new Swiper('.index-notice .swiper-container', {
  speed: 1800,
  spaceBetween: 10,
  direction: 'vertical',
  noSwiping: true,
  loop: true,
  autoplay: {
    delay: 2000
  },
  watchOverflow: true, //因为仅有1个slide，swiper无效

});


// banner
var bannerSwiper = new Swiper('.banner .swiper-container', {
  speed: 1800,
  spaceBetween: 10,
  loop: true,
  autoplay: {
    delay: 2000
  },
  pagination: {
    el: '.swiper-pagination',
  },
  watchOverflow: true, //因为仅有1个slide，swiper无效

});



// 赛绩
var sjSwiper = new Swiper('.perform-con .swiper-container', {
  speed: 1800,
  spaceBetween: 8,
  loop: true,
  autoplay: {
    delay: 2000
  },
  centeredSlides: true,
  slidesPerView: 'auto',
  watchOverflow: true, //因为仅有1个slide，swiper无效

});









var height = $(window).height();

//scroll() 

$(window).scroll(function () {
  if ($(window).scrollTop() > height) {
    $(".scroll-top").addClass("active");
  } else {
    $(".scroll-top").removeClass("active");
  }
});
$(".scroll-top").click(function () {

  $('body,html').animate({
    scrollTop: 0
  }, 300);

  return false;

});


// 打开菜单弹窗
$(".menu-btn").click(function () {
  $(".menu-popup").fadeIn(300);
})

// 关闭菜单弹窗
$(".menu-popup .menu-header .close-menu").click(function () {
  $(this).parents(".menu-popup").hide();
})

// 打开搜索弹窗
$(".search-box").click(function () {
  $(".search-popup").fadeIn(300);
})
// 关闭搜索弹窗
$(".search-popup .search-header .search-close-btn").click(function () {
  $(this).parents(".search-popup").hide();
})
